import java.util.Comparator;
import java.util.Objects;

public class Test {
    public static void main(String[] args) {
        Card c1 = new Card("haongtao", 15);
        Card c2 = new Card("heitao", 3);
        System.out.println(c1.equals(c2));
        if (c1.compareTo(c2) > 0) {
            System.out.println("c1 > c2");
        } else {
            System.out.println("c1 <= c2");
        }

        Incmp incmp = new Incmp();
        System.out.println(incmp.compare(c1, c2));


    }

}

class Card implements Comparable<Card>{
    public String suit;
    public int stank;

    public Card(String suit, int stank) {
        this.suit = suit;
        this.stank = stank;
    }
    @Override
    public int compareTo(Card o) {
        return this.stank - o.stank;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Card card = (Card) o;
        return stank == card.stank && Objects.equals(suit, card.suit);
    }

    @Override
    public int hashCode() {
        return Objects.hash(suit, stank);
    }



    @Override
    public String toString() {
        return "Card{" +
                "suit='" + suit + '\'' +
                ", stank=" + stank +
                '}';
    }
}

class Incmp implements Comparator<Card>{
    @Override
    public int compare(Card o1, Card o2) {
        return o1.suit.compareTo(o2.suit);
    }
}
